package com.tech15.core.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javacommon.base.BaseHibernateDao;

import org.springframework.stereotype.Repository;

import com.tech15.core.model.SearchData;

@Repository
public class SearchDataDao extends BaseHibernateDao<Object,Long>{

	@Override
	public Class getEntityClass() {
		return null;
	}
	/**
	 * hql查询数据
	 * @param sql
	 * @return
	 */
	public List<Object> searchHqlData(String hql){
		return getHibernateTemplate().find(hql);
	}
	/**
	 * hql按条件查询数据
	 * @param hql
	 * @param obj
	 * @return
	 */
	public List<Object> searchHqlData(String hql,Object obj){
		return getHibernateTemplate().find(hql,obj);
	}
	/**
	 * sql查询数据
	 * @param sql
	 * @return
	 */
	public List<Object> searchSqlData(String sql){
		Map map = new HashMap();
		map.put("strid", "String");
		map.put("name", "String");
		return findSqlAll(sql, map, SearchData.class);
	}
	/**
	 * sql按条件查询数据
	 * @param sql
	 * @param obj
	 * @return
	 */
	public List<Object> searchSqlData(String sql,String condition){
		System.out.println(sql);
		sql = sql.replaceAll("[?]", condition);
		System.out.println(sql);
		Map map = new HashMap();
		map.put("strid", "String");
		map.put("name", "String");
		return findSqlAll(sql, map, SearchData.class);
	}
	
}
